Frame

public interface Frame

A frame in the browser.

Each web page loaded in the browser has a main (top-level) frame. The frame itself may have child frames. When a web page is unloaded, its frame and all child frames are closed automatically. Any attempt to work with an already closed frame will lead to the IllegalStateException error.

Properties

Link copied to clipboard
public final Browser browser
public final Browser browser

Browser instance of this frame.

Link copied to clipboard
public final List<Frame> children
public final List<Frame> children

The list of child frames or an empty list if this frame does not have any children.

Link copied to clipboard
public final Document document
public final Document document

The document object model (DOM) of this frame, if any.

Link copied to clipboard
public final String html
public final String html

Content of the frame in the HTML format, or an empty string if the frame doesn't have a content or its content is empty.

Link copied to clipboard
public final Json json
public final Json json

The Json instance for this frame.

Link copied to clipboard
public final WebStorage localStorage
public final WebStorage localStorage

The localStorage instance of this frame.

Link copied to clipboard
public final String name
public final String name

The name of the frame, or an empty string if the frame doesn't have a name.

Link copied to clipboard
public final Frame parent
public final Frame parent

The parent Frame instance or null if the current frame is a main (top-level) frame, and it does not have a parent.

Link copied to clipboard

The sessionStorage instance of this frame.

Functions

Link copied to clipboard
public abstract Browser browser()
Returns the Browser instance of this frame.
Link copied to clipboard
public abstract List<Frame> children()
Returns the list of child frames or an empty list if this frame does not have any children.
Link copied to clipboard
public abstract Optional<Document> document()
Returns an Optional that contains the DOM Document instance of the frame or an empty Optional if the frame does not have a document.
Link copied to clipboard
public abstract boolean execute(EditorCommand command)
Executes the given command in the frame.
Link copied to clipboard
@Nullable()
public abstract T executeJavaScript<T>(String javaScript)
Executes the given javaScript code in the frame and returns the result of the execution.
public abstract void executeJavaScript(String javaScript, Consumer<? extends Object> callback)
Executes the given javaScript code in the frame and returns the result of the execution through the given callback.
Link copied to clipboard
public abstract boolean hasSelection()
Returns true if some content in this frame is selected.
Link copied to clipboard
public abstract String html()
Returns a string that represents content of the frame in the HTML format or an empty string if the frame does not have a content or its content is empty.
Link copied to clipboard
public abstract PointInspection inspect(Point location)
Inspects the given location on the web page containing this frame and returns the result of the inspection.
public abstract PointInspection inspect(int x, int y)
Inspects the given location on the web page containing this frame and returns the result of the inspection.
Link copied to clipboard
public abstract boolean isCommandEnabled(EditorCommand.Name commandName)
Returns true if the command with the given commandName can be executed in the frame.
Link copied to clipboard
public abstract boolean isMain()
Returns true if the frame is a main (top-level) frame in the browser.
Link copied to clipboard
public abstract Json json()
Returns the Json instance for this frame.
Link copied to clipboard
public abstract void loadHtml(String html)
Navigates the frame to a data URL assembled from the given HTML.
Link copied to clipboard
public abstract void loadUrl(String url)
Navigates the frame to a resource identified by the given url.
Link copied to clipboard
public abstract WebStorage localStorage()
Returns the localStorage instance of this frame.
Link copied to clipboard
public abstract String name()
Returns a string that represent the name of the frame or an empty string if the frame does not have a name.
Link copied to clipboard
public abstract Optional<Frame> parent()
Returns an Optional that contains the parent Frame instance or an empty Optional if the current frame is a main (top-level) frame and it does not have a parent.
Link copied to clipboard
public abstract void print()
Requests printing of the currently loaded web page in this frame.
Link copied to clipboard
public abstract RenderProcess renderProcess()
Returns a RenderProcess associated with the current Frame instance.
Link copied to clipboard
public abstract String selectionAsHtml()
Returns a string that contains HTML of the selected content in the frame or an empty string if there is no selection.
Link copied to clipboard
public abstract String selectionAsText()
Returns a text representation of the selected content in the frame or an empty string if there is no selection.
Link copied to clipboard
public abstract WebStorage sessionStorage()
Returns the sessionStorage instance of this frame.
Link copied to clipboard
public abstract String text()
Returns the content of the frame and its sub-frames as plain text or an empty string if the frame does not have content or its content is empty.
Link copied to clipboard
public abstract void viewSource()
Creates a new popup where the view-source:<frame-url> URL is loaded to display HTML source of the frame.